#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

"""
@File    : ate_code.py
@Author  : Link
@Time    : 2022/12/6 21:03
@Mark    : 
"""
from dataclasses import dataclass
from enum import IntEnum


@dataclass
class AteCode:
    DUT: int = 0
    CODE: int = 0


class AteCore:
    PASS = 1
    FAIL = 0

    RunType = 0b0001 << 8
    Serial = RunType | 0x1  # SITE之间串行
    Parallel = RunType | 0x2  # SITE之间并行&默认
    MultiThread = RunType | 0x11  # 同步运行模式
    Synchronization = RunType | 0x12  # 异步运行模式

    RunMethod = 0b0010 << 8
    MasterMethod = RunMethod | 0x1  # 主
    SlaveMethod = RunMethod | 0x2  # 从

    RunCode = 0b0100 << 8
    PerLotStart: int = RunCode | 0x1
    PerWaferStart: int = RunCode | 0x3
    PerRun: int = RunCode | 0x5
    DutRun: int = RunCode | 0x6
    FinishRun: int = RunCode | 0x7
    PostRun: int = RunCode | 0x8
    PostLotStop: int = RunCode | 0x9

    PcReboot = RunCode | 0x21
    PcAlarm = RunCode | 0x22


class StatusCode(IntEnum):
    BaseCode = 0xA00

    DutIdle = BaseCode | 0x3  # 这个dut是闲置状态
    DutActive = BaseCode | 0x4  # 这个dut是在运行的状态


class DtrType:
    Info = "Info"
    Debug = "Debug"
    Record = "Record"
    Warning = "Warning"
    Success = "Success"
    Error = "Error"
